﻿@model GPS.ENTITYS.ViewModelDHV_HS
@using PagedList.Mvc;
@using GPS.Helpers;
@{
    ViewBag.Title = "Hồ sơ học viên";
}

<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Scripts/datepicker.js"></script>



<div class="container fdb-div-content fdb-div-corner-all">
    <h3 class="text-center fdb-title-search-form">Thông tin học viên</h3>

    <div class="row">
        @using (Html.BeginForm("Index", "GPS_HocVienHoSo", FormMethod.Get))
        {
        <a href="#" class="show_hide">Hiển thị khung tìm kiếm</a>
        <div class="criteria_search">
            <br />
            <div class="row">
                <div class="col-md-2 control-label">
                    Mã hồ sơ học viên
                </div>
                <div class="col-md-4">
                    @Html.TextBoxFor(model => model.pHV_HS_HV_MA, new { @class = "form-control" })
                </div>
                <div class="col-md-2 control-label">
                    Số hồ sơ
                </div>
                <div class="col-md-4">
                    @Html.TextBoxFor(model => model.pHV_HS_SOHS, new { @class = "form-control" })
                </div>
            </div>
            <div class="row margin-top-05">
                <div class="col-md-2 control-label">
                    Đơn vị đào tạo
                </div>
                <div class="col-md-4">
                    @Html.DropDownListFor(model => model.pHV_HS_DVGTVT_MA, (SelectList)ViewBag.pHV_HS_DVGTVT_MAs, string.Empty, new { @class = "form-control", @id = "pHV_HS_DVGTVT_MA_dll" })
                </div>
                <div class="col-md-2 control-label">

                </div>
                <div class="col-md-4">

                </div>
            </div>
            <div class="row">
                <div class="col-md-2 control-label">
                    ngày nhận hồ sơ từ
                </div>
                <div class="col-md-4">

                    @Html.TextBoxFor(model => model.pHV_HS_NGAY_NHANHS_TU, "{0:dd/MM/yyyy}", new { @class = "form-control", @style = "width:120px" })
                </div>

                <div class="col-md-2 control-label">
                    ngày nhận hồ sơ đến
                </div>
                <div class="col-md-4">
                    @Html.TextBoxFor(model => model.pHV_HS_NGAY_NHANHS_DEN, "{0:dd/MM/yyyy}", new { @class = "form-control", @style = "width:120px" })

                </div>
            </div>
        </div>
        <div class="row margin-top-05 btn_search">
            <button type="submit" class="btn btn-primary btn-sm">
                <span class="glyphicon glyphicon-search"></span> Tìm kiếm
            </button>
            @Html.NoEncodeActionLink("<span class='glyphicon glyphicon-plus'></span> Thêm mới", "Thêm mới", "Create", "GPS_HocVienHoSo", null, htmlAttributes: new { @class = "btn btn-primary btn-sm" })
            <button type="submit" class="btn btn-primary btn-sm" name="SearchButton" value="Xuất Excel">
                <i class='fa fa-file-excel-o'></i> Xuất Excel
            </button>
            @Html.NoEncodeActionLink("<i class='fa fa-file-excel-o'></i> Import Excel", "Import Excel", "ImportExcel", "GPS_HocVienHoSo", null, htmlAttributes: new { @class = "btn btn-primary btn-sm" })
        </div>
        }
    </div>

    <div class="row">
        <fieldset class="fdb-scheduler-border">
            <legend class="fdb-scheduler-search-border">Kết quả tìm kiếm</legend>
            <label id="lblMessageTotal" style="color:blue; font-weight:bold">Tổng số bản ghi: @ViewBag.TotalRow</label> &nbsp;&nbsp;&nbsp;
            <table class="table table-hover table-bordered table-condensed">
                <tr>
                    <th>
                        Mã hồ sơ học viên
                    </th>
                    <th>
                        Đơn vị GTVT
                    </th>
                    <th>
                        Hình ảnh hồ sơ
                    </th>
                    <th>
                        Số hồ sơ
                    </th>
                    <th>
                        Ngày nhận hồ sơ
                    </th>
                    <th>
                        Ngày hẹn trả hồ sơ
                    </th>
                    <th>
                        Người nhận hồ sơ
                    </th>

                    <th>
                        Mã đơn vị GTVT nhận
                    </th>

                    <th>
                        Trạng thái
                    </th>
                    <th></th>
                </tr>
                @{
                    if (Model.SearchResults != null)
                    {
                        foreach (var item in Model.SearchResults)
                        {
                            <tr>
                                <td>
                                    @Html.DisplayFor(modelItem => item.HV_HS_HV_MA)
                                </td>
                                <td>
                                    @Html.DisplayFor(modelItem => (item.HV_HS_DVGTVT_MA))
                                </td>
                                <td>
                                    @{
                            String img64Url = string.Empty;
                            if (item.HV_HS_ANH != null)
                            {
                                String img64 = Convert.ToBase64String(item.HV_HS_ANH);
                                img64Url = string.Format("data:image/" + item.HV_HS_ANH + ";base64,{0}", img64); //imagetype can be e.g. gif, jpeg, png etc.
                            }

                                    }
                                    <img src="@img64Url" width="50" height="50" />
                                </td>
                                <td>
                                    @Html.DisplayFor(modelItem => item.HV_HS_SOHOSO)
                                </td>
                                <td>
                                    @Html.DisplayFor(modelItem => item.HV_HS_NGAY_NHANHS)
                                </td>
                                <td>
                                    @Html.DisplayFor(modelItem => item.HV_HS_NGAYHENTRA)
                                </td>
                                <td>
                                    @Html.DisplayFor(modelItem => item.HV_HS_NGUOI_NHANHS)
                                </td>
                                <td>
                                    @Html.DisplayFor(modelItem => item.HV_HS_DVGTVT_MA_NHANHS)
                                </td>
                                <td>
                                    @Html.DisplayFor(modelItem => item.HV_HS_ACTIVE)
                                </td>
                                <td>
                                    <div class="pull-right">
                                        <a href="@Url.Action("Edit", "GPS_HocVienHoSo", new { id = item.ID })">
                                            <img src="@Url.Content("~/fonts/grid-edit-icon.png")" title="Sửa hồ sơ học viên" />
                                        </a>

                                        <a href="@Url.Action("Delete", "GPS_HocVienHoSo", new { id = item.ID })" delete-modal="">
                                            <img src="@Url.Content("~/fonts/grid-delete-icon1.gif")" title="Hủy hồ sơ học viên" />
                                        </a>
                                    </div>
                                </td>
                            </tr>
                        }
                    }
                }
            </table>
        </fieldset>
    </div>
    <div class="pagination-sm">
        @Html.PagedListPager(Model.SearchResults, page => Url.Action("Index", new
   {
       page,
       Model.pHV_HS_HV_MA,
       Model.pHV_HS_DVGTVT_MA,
       Model.pHV_HS_SOHS,
       Model.pHV_HS_NGAY_NHANHS_TU,
       Model.pHV_HS_NGAY_NHANHS_DEN
   }))
    </div>
</div>


<!-- delete modal placeholder-->
<div id='deleteModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='deleteModalContent'></div>
        </div>
    </div>
</div>

<!-- modal placeholder-->
<div id='myModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='myModalContent'></div>
        </div>
    </div>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/modalform")
}


<script src="~/Scripts/jquery-ui-1.11.4.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js" type="text/javascript"></script>
<script src="~/Scripts/datepicker.js"></script>
<script src="~/Scripts/jquery-ui-1.11.4.js"></script>
<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Scripts/jquery.maskMoney.js"></script>
<script src="~/Scripts/jquery.number.js"></script>
<script src="~/Scripts/jquery.masknumber.js"></script>
<script type="text/javascript">

    $("#pHV_HS_NGAY_NHANHS_TU").datepicker({
        changeMonth: true,
        changeYear: true,

        dateFormat: 'dd/mm/yy'
    });
    $("#pHV_HS_NGAY_NHANHS_TU").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });

    $("#pHV_HS_NGAY_NHANHS_DEN").datepicker({
        changeMonth: true,
        changeYear: true,

        dateFormat: 'dd/mm/yy'
    });
    $("#pHV_HS_NGAY_NHANHS_DEN").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });


    $(function () {
        $(document).tooltip();
    });

</script>